package servlet.servlet_yaobo;

import pojo.HarvestAddress;
import service.impl.ImpShoppingMemberService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 用于修改收获地址
 */
@WebServlet(value = "/dress")
public class shouHuoServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        HarvestAddress har=new HarvestAddress();
        har.setHarve_Id(Integer.parseInt(req.getParameter("Id")));
        String region=req.getParameter("Region");
        String address=req.getParameter("Address");
        if(region!=null&&address!=null){
            region=new String(region.getBytes("ISO-8859-1"),"UTF-8");
            address=new String(address.getBytes("ISO-8859-1"),"UTF-8");
        }
        System.out.println(region+""+address);
        har.setHarve_Region(region);
        har.setHarve_Address(address);
        ImpShoppingMemberService imp=new ImpShoppingMemberService();
        imp.setShouHuo(har);
    }
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
